$(document).ready(function(){

	jQuery.fn.submitRegistrationForm = function(category) {
        alert(  window.location.search.substring(1));
	// action is functionality we want to call and outputJSON is our data
        $.ajax({
        	url: IPSERVIDOR + SERVICES+'/getLocations.php?' + window.location.search.substring(1),
            dataType: 'jsonp',
            type: 'post',                   
            async: true,
            cache: false,
            beforeSend: function() {
                // This callback function will trigger before data is sent
                    $.mobile.loading( "show", {
                        text: "Buscando información... ",
                        textVisible: true,
                        theme: $.mobile.loader.prototype.options.theme,
                        textonly: false,
                        html: ""
                    });
            },
            complete: function() {
                // This callback function will trigger on data sent/received complete
                $.mobile.loading( "hide" );
            },
            success: function (result) {   
            	
            		//localStorage.userDB = $("#usuario").val();
                /**$.each(result.response, function(i,item){ 
                    $('#resultado').append($("<div ></div>").append($("<a>"+item.name+"</a>")
                        .attr('class', 'ui-btn ui-shadow ui-corner-all')) ).attr('class', 'ui-grid-a ui-responsive'); 
                });

*/
                $.each(result.response, function(i,item){ 
                    $('#resultado').append($("<div data-role='collapsible'></div>")
                        //.attr("class","ui-collapsible ui-collapsible-inset ui-corner-all ui-collapsible-themed-content ui-collapsible-collapsed").attr("data-role","collapsible")
                        .append($("<h4>"+item.name+"</h4>"))
                        
                        
                            .append($("<p>"+item.address+"</p>"))); 
                });
                $('div[data-role=collapsible]').collapsible();

            		         	
            },
            error: function (request,error) {
                // This callback function will trigger on unsuccessful action                
                alert('Un Error en la conexión ocurrio, Intente de nuevo!!');
            }
        });  
	}


    $(this).submitRegistrationForm("gasolinera");

        
});